package com.woniuxy.controller;


import com.woniuxy.pojo.Department;
import com.woniuxy.pojo.RespBean;
import com.woniuxy.service.IDepartmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuankaiqiang
 * @since 2022-01-28
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {
   @Autowired
    private IDepartmentService departmentService;
   @ApiOperation(value = "获取所有部门")
   @GetMapping("/")
   public List<Department> getDepartment(){
       return departmentService.getAllDepartment();
   }

   @ApiOperation(value = "添加部门")
    @PostMapping("/")
    public RespBean addDep(@RequestBody Department department){
       return departmentService.addDep(department);
   }

   @ApiOperation(value = "删除部门")
    @DeleteMapping("/{id}")
    public RespBean deleteDep(@PathVariable Integer id){
       return departmentService.deleteDep(id);
   }
}
